import { Module } from "@nestjs/common";
import { ConfigModule } from "@nestjs/config";

import { AppController } from "./app.controller";
import { AuthModule } from "./auth/auth.module";
import configuration from "./config/configuration";
import { validateEnv } from "./config/env.validation";
import { OutputsModule } from "./outputs/outputs.module";
import { PrismaModule } from "./prisma/prisma.module";
import { ProjectsModule } from "./projects/projects.module";
import { UsersModule } from "./users/users.module";

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      envFilePath: ["apps/api/.env.local", "apps/api/.env", ".env.local", ".env"],
      load: [configuration],
      validate: validateEnv
    }),
    PrismaModule,
    UsersModule,
    AuthModule,
    ProjectsModule,
    OutputsModule
  ],
  controllers: [AppController]
})
export class AppModule {}